#ifdef _WIN32 
#include <windows.h> 
#endif

#include "Deer.h"

Deer::Deer(glm::vec3 _Pos, float _r, float _speed, std::string _Name,
		std::string _modelFName, ModelPool *_mPool, PathFinder *_pathfinder,
		Terrain::Terrain *_ter) :
		Animal(_Pos, _r, _speed, _Name, _modelFName, _mPool, _pathfinder, _ter)
{

	type = OBJ_DEER;
	parentType = OBJ_ANIMAL;
	status = STATUS_READY;

	for (int i = 0; i < 55; i++)
	{
		std::stringstream ss; //create a stringstream
		ss << i + 1; //add number to the stream
		modelID.push_back(mPool->loadModel(modelFName, "_0000" + ss.str()));
	}

	//pathfinder->ReservePosition((int)Pos.x , (int)Pos.z, this);

}

Deer::~Deer(void)
{
}

void Deer::updateAnimation()
{
	if (Moving)
	{

		if (speed == basespeed)
			animationPos = animationPos + 0.45;
		else
			animationPos = animationPos + 0.56;

		if ((animationPos > modelID.size() - 26) && (speed == basespeed))
			animationPos = 1.0;

		if ((animationPos > modelID.size() - 1) && (speed != basespeed))
			animationPos = 31.0;
	}
	else
		animationPos = 1.0;
}